package com.iwhalecloud.bss.kite.cucc.service.job.shoppingcart;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.cucc.client.api.shoppingcart.operate.ICuccOperateShoppingCartService;
import com.ztesoft.bss.common.util.SpringUtil;
import com.ztesoft.common.logger.api.ZLogger;
import com.ztesoft.common.logger.factory.ZLoggerFactory;

/**
 * 清理购物车分组&场景实例缓存定时任务
 */
public class LocalClearShoppingCartJob implements SimpleJob {

    private final ZLogger logger = ZLoggerFactory.getLogger(this.getClass(), KeyConsts.LOG_MODULE);

    @Override
    public void execute(ShardingContext shardingContext) {
        logger.info("******************** 清理购物车分组缓存开始 ********************");
        long start = System.currentTimeMillis();
        ICuccOperateShoppingCartService clearShoppingCartService = SpringUtil.getBean(ICuccOperateShoppingCartService.class);
        clearShoppingCartService.clearShoppingCart();
        long end = System.currentTimeMillis();
        logger.info("*************** 清理购物车分组缓存结束，耗时[" + (end - start) + "]ms ***************");
    }
}
